/**
  * @Author: songgh
  * @Date: 2021-09-20 14:41:08
  * @LastEditors: songgh
  * @LastEditTime: 2021-09-20 15:41:08
  * @Description: 防抖
  */
export function debounce(time:(null|number) = null, fn:Function, delay: number):Function {
    return function ():void {
        if (time) {
            clearTimeout(time);
        }
        time = setTimeout(() => {
            fn(...arguments);
        }, delay);
    };
}